package util;

import Main.ConfigurationBean;
import com.alibaba.fastjson.JSON;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @author zhongwen
 * @description 处理Json配置文件的工具
 * @date 2021-12-22 20:56
 */
public class GsonUils {
    public static void objectToString(ConfigurationBean configurationBean){
        String workPath = configurationBean.getWorkPath();
        String text = JSON.toJSONString(configurationBean);
        try {
            BufferedWriter writer = new BufferedWriter(new FileWriter(workPath));
            writer.write(text);
            writer.flush();
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
